import {request} from "./request";

// 1.详情页一般数据
export function getDetail(iid){
  return request({
    url:'/detail',
    // 给服务器网页传入getDetail里面的参数iid
    params:{
      iid
    }
  })
}

// 2.详情页推荐数据
export function getRecommend(){
  return request({
    url:'/recommend'
  })
}

// 商品基本信息
export class Goods{
  constructor(columns, services, itemInfo) {
    this.columns = columns
    this.services = services
    this.title = itemInfo.title
    this.price = itemInfo.price
    this.oldPrice = itemInfo.oldPrice
    this.discountDesc = itemInfo.discountDesc
    this.desc = itemInfo.desc
    this.realPrice = itemInfo.lowNowPrice
  }
}

// 商店信息
export class Shop{
  constructor(shopInfo) {
    this.shopLogo = shopInfo.shopLogo
    this.name = shopInfo.name
    this.cFans = shopInfo.cFans
    this.cGoods = shopInfo.cGoods
    this.cSells = shopInfo.cSells
    this.score = shopInfo.score
  }
}

// 参数信息
export class Params{
  constructor(itemParams) {
    this.images = itemParams.info.images ? itemParams.info.images : ''
    this.infos = itemParams.info.set
    this.sizes = itemParams.rule.tables
  }
}